#include <iostream>
#include <vector>
#include <numeric>

using namespace std;

static int times(int a, int b) {
    vector<int> v {1};
    int c = 0;
    for (int i = 0; i < b; ++i) {
        for (int j = 0; j < v.size(); ++j) {
            c += v[j] * a;
            v[j] = c % 10;
            c /= 10;
        }
        while (c) {
            v.push_back(c % 10);
            c /= 10;
        }
    }
    return accumulate(v.begin(), v.end(), 0);
}

int main() {
    int r = 0;
    for (int i = 1; i < 100; ++i) {
        for (int j = 1; j < 100; ++j) {
            int t = times(i, j);
            if (t > r)
                r = t;
        }
    }
    cout << r << endl;
}